function Node(value){
    this.val = value;
    this.left = null;
    this.right = null;
}

var a = new Node("a");
var b = new Node("b");
var c = new Node("c");
var d = new Node("d");
var e = new Node("e");
var f = new Node("f");
a.left = b;
a.right = c;
b.left = d;
b.right = e;
d.left = f;

// 分行从上到下打印二叉树  广度遍历
function print(root){
    if(root == null) return;
    var arr = [];
    var node = root;
    arr.push(node);
    while(arr.length){
        var temp = arr.shift();
        console.log(temp.val);
        if(temp.left != null){
            arr.push(temp.left);
        }
        if(temp.right!=null){
            arr.push(temp.right);
        }
    }
}
// 深度bianli
function dfs(root) {
    if(root == null) return;
    console.log(root.val);
    dfs(root.left);
    dfs(root.right);
}

// print(a);
dfs(a);
